html(lav="zh-CN")
  head
    meta(http-equiv="Content-Type" content="text/html; charset=UTF-8")
    meta(http-equiv="X-UA-Compatible" content="IE=edge, chrome=1")
    meta(name="keywords" content="")
    meta(name="description" content="")
    meta(name="author" content="")
    meta(content="email=no" name="format-detection" )
    meta(name="format-detection" content="telephone=no" )
    meta(name="apple-touch-fullscreen" content="yes" )
    meta(name="apple-mobile-web-app-capable" content="yes" )
    meta(http-equiv="Content-Type" content="text/html;charset=UTF-8" )
    meta(name="apple-mobile-web-app-status-bar-style" content="black" )
    meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=no" )
    //- 公共样式
    link(rel="stylesheet" href="/mobile/dest/libs/pure/pure.min.css")
    link(rel="stylesheet" href="/mobile/dest/libs/pure/grids-responsive.min.css")
    link(rel="stylesheet" type="text/css" href="/mobile/dest/views/department/department.css")
    link(rel="stylesheet" type="text/css" href="/mobile/dest/css/comm.css")
    //- link(rel="icon" href="./favicon.ico" mce_href="./favicon.ico" type="image/x-icon" id="icoLink")
    //- link(rel="icon" href="" mce_href="" type="image/x-icon" id="icoLink")
    title
  body
    div(id="app1")
      .email-content
        //- 加载中
        .loadding(:class="loaddingClass")
          .load-txt 加载数据中...
          .load-ico

        //- 加载失败
        .loaded-fail(:class="loadedFailClass") {{loadedFail}}

        div(:class="loadedSuccClass")
          //- 显示标题
          .email-content-header.pure-g
            .pure-u-1
              h4.email-content-title 系统管理

          //- 加载成功
          .email-content-body
            c-dialog(:dlgOpt="dlgOpt")

            //- 操作选项卡
            .pure-menu.pure-menu-horizontal(v-if="0 == tab_active_idx")
              ul
                li 查询导航
                
              //- 查询选项卡
              .c-main.c-tab-clear-fixed(v-if="0 == tab_active_idx")
                c-zoom(v-bind:zoom-options ="zoomOpt" v-show="showZoom")

                form.pure-form.pure-form-aligned(novalidate="" v-show="!showComp")
                  .pure-g.c-row
                    
                    .pure-u-1.pure-u-md-1-2
                      .pure-g
                        label.pure-u.c-label 部门名称：
                        select.pure-u-16-24(v-model="departmentQuery.department_id" v-on:change.stop.prevent="onSelectChange($event,'department_name')")
                          option(:value="item.id" v-for="item in departmentArray") {{item.name}}
                        //- input.pure-u-16-24(type="text" v-model="departmentQuery.department_name" placeholder="请输入字典名称")

                    .pure-u-1.pure-u-md-1-2
                      .pure-g
                        label.pure-u.c-label 检查时间：
                        input.pure-u-16-24(type="date" v-model="departmentQuery.curr_date" placeholder="请输入日期")

                  .pure-g.c-row
                    .pure-u-1.c-button.c-query-padding
                      button.pure-button.pure-button-primary.c-query-pure-button(type="button" v-on:click.stop.prevent="onSearchDepartment();") 查询
                      span.pure-u-1-24 &nbsp;
                      button.pure-button.pure-button-primary.c-reset-pure-button(type="button" v-on:click.stop.prevent="onReset();") 重置

                c-select-tree(v-bind:tree-options="treeOpt" v-show="showTree")
                c-upload-file(v-bind:upload-options="uploadOpt" v-if="showUpload")

              div
                ul
                  li.line
                    span 列表
                    button.pure-button-primary.pure-button.c-new-pure-button(v-on:click.stop.prevent="onAddDepartment();") 新增
                  //- li.c-tab-pure-menu-item.c-menu-item-mgr.c-new-email-content-controls
                  //-   button.pure-button-primary.pure-button.c-new-pure-button(v-on:click.stop.prevent="onAddDepartment();") 新增

                div
                  table.pure-table.pure-table-horizontal.c-table
                    thead
                      tr
                        th 发起部门 
                        th 日期
                        th 检查事项 
                        th 附件
                        th 操作

                    tbody
                      tr(v-for="(department, idx) in departmentList" v-bind:class="{'pure-table-odd': 0 != idx%2}")
                        //- td(data-title='部门') {{department.department_id}}
                        td(data-title='名称') {{department.department_name}}
                        td(data-title='日期') {{department.curr_date}}
                        td(data-title='检查事项') {{department.examine_thing}}
                        td(data-title='附件') 
                          a(v-bind:href="department.file_url" target="_blank" v-text="department.file_url || '-'")
                        td(data-title='操作')
                          a.c-cont-pure-button(href="javascript:;" v-on:click.stop.prevent="onEditDepartment(department);") 编辑
                          span &nbsp;&nbsp;|&nbsp;&nbsp;
                          a.c-cont-pure-button(href="javascript:;" v-on:click.stop.prevent="onRemoveResouce(department._id);") 删除
                  
                  //- 分页
                  .paging-nav.clearfix
                    .paging-cont
                      span 共&nbsp;{{pageCount}}&nbsp;页
                      a(href='#', onclick='return false;', rel='first', @click='gotoPage(1)', v-show='pageNum>1') 第一页
                      a(href='#', onclick='return false;', rel='prev', @click='gotoPage(pageNum-1)', v-show='pageNum>1') 上一页
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum-3)', v-show='pageNum-3>0') {{pageNum-3}}
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum-2)', v-show='pageNum-2>0') {{pageNum-2}}
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum-1)', v-show='pageNum-1>0') {{pageNum-1}}
                      strong {{pageNum}}
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum+1)', v-show='pageNum+1<=pageCount') {{pageNum+1}}
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum+2)', v-show='pageNum+2<=pageCount') {{pageNum+2}}
                      a(href='#', onclick='return false;', @click='gotoPage(pageNum+3)', v-show='pageNum+3<=pageCount') {{pageNum+3}}
                      a(href='#', onclick='return false;', rel='next', @click='gotoPage(pageNum-1+2)', v-show='pageNum<pageCount') 下一页
                      a(href='#', onclick='return false;', rel='last', @click='gotoPage(pageCount)', v-show='pageNum<pageCount') 最后一页

                //- 弹出框
                .js_dialog(:class="{'c-dialog-show': dlgOpt.state, 'c-dialog-hide': !dlgOpt.state}")
                  .c-mask
                  .c-dialog
                    .c-dialog-hd
                      strong.c-dialog-title {{dlgOpt.title}}
                      .c-dialog-close(v-on:click.stop.prevent="dlgOpt.cancel()")
                    .c-dialog-bd
                      div(v-if="!!dlgOpt.content")
                        span.c-dialog-font {{dlgOpt.content}}
                      div(v-else)
                        slot
                    .c-dialog-ft
                      a.pure-button.c-cancel-btn(href="javascript:;" v-if="'confirm' == dlgOpt.msg_type" v-on:click.stop.prevent="dlgOpt.cancel()" ) 取消
                      a.pure-button.pure-button-primary(href="javascript:;" v-if="'confirm' == dlgOpt.msg_type" v-on:click.stop.prevent="dlgOpt.ok()") 确定
                      a.pure-button.pure-button-primary.c-know-btn(href="javascript:;" v-if="'warn' == dlgOpt.msg_type" v-on:click.stop.prevent="dlgOpt.cancel()") 确定

            //- 编辑选项卡
            .c-main.c-tab-clear-fixed(v-if="2 == tab_active_idx")
              c-zoom(v-bind:zoom-options ="zoomOpt" v-show="showZoom")

              form.pure-form.pure-form-aligned(v-show="!showComp" novalidate="")
                c-form-tips(:form-tips-option="formTipsOpt")

                .pure-g.c-row
                  .pure-u-1.pure-u-md-1-2
                    .pure-g
                      label.pure-u.c-label 发起部门：
                      input(type="hidden" v-model="departmentDetail.department_name")
                      select.pure-u-16-24(v-model="departmentDetail.department_id" v-on:change.stop.prevent="onSelectChange($event,'department_name')")
                        option(:value="item.id" v-for="item in departmentArray") {{item.name}}
                      //- input.pure-u-16-24(type="text" v-model="departmentDetail.department_name" required )
                      span.c-font-red *

                  .pure-u-1.pure-u-md-1-2
                    .pure-g
                      label.pure-u.c-label 检查日期：
                      input.pure-u-16-24(type="date" v-model="departmentDetail.curr_date" required )
                      span.c-font-red *

                .pure-g.c-row
                  .pure-u-1-1
                    .pure-g
                      label.pure-u.c-label 检查事项：
                      input.pure-u-20-24(type="text" v-model="departmentDetail.examine_thing" required )
                      span.c-font-red *

                .pure-g.c-row
                  .pure-u-1.pure-u-md-1-2
                    .pure-g
                      label.pure-u.c-label &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;附件：
                      input.pure-u-16-24(type="file" name="resource" id="resource" v-on:change.stop.prevent="onFileChange(event)" multiple="multiple")
                      //- span.c-font-red *

                  //- .pure-u-1.pure-u-md-1-2(v-show="upload_file_list.levth>0")
                  //-   .pure-g
                  //-     label.pure-u.c-label 上传附件名：
                  //-     select.pure-u-16-24(id="file_list")
                  //-       option(v-for="item in upload_file_list") {{item.name}}

                .pure-g.c-row
                  .pure-u-1-1
                    .pure-g
                      label.pure-u.c-label &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;备注：
                      textarea.pure-u-20-24(v-model="departmentDetail.remark")

                .pure-g.c-row
                  .pure-u-1
                    button.pure-button.pure-button-primary.c-save-pure-button.right(type="button" v-on:click.stop.prevent="onSaveDepartment();") 保存
                    
                    button.pure-button.pure-button-primary.c-reset-pure-button(type="button" v-on:click.stop.prevent="onBack();") 返回
              c-select-tree(v-bind:tree-options="treeOpt" v-show="showTree")
              c-upload-file(v-bind:upload-options="uploadOpt" v-if="showUpload")

    //- 模块加载，入口配置
    script(type="text/javascript" src="/mobile/dest/libs/vue/vue.min.js")
    script(type="text/javascript" src="/mobile/dest/libs/vue/vue-resource.min.js")
    script(type="text/javascript" src="/mobile/dest/libs/jquery.min.js")

    script(type="text/javascript" src="/mobile/dest/libs/sea/sea.min.js")
    script(type="text/javascript" src="/mobile/dest/libs/sea/seajs-text.js")
    script(type="text/javascript" src="/mobile/dest/libs/sea/seajs-css.js")

    script(type="text/javascript" src="/mobile/dest/views/department/department.js")